Malicious port scan detection using port profiles

ABSTRACT

Methods, apparatus and computer software products implement embodiments of the present invention that include defining, for a given software category, respective, disjoint sets of communication ports that are used by each of a plurality of software systems in the given software category, including at least first and second disjoint sets. A set of port scans are identified in data traffic transmitted between multiple nodes that communicate over a network, each of the port scans including an access, in the data traffic, of a plurality of the communication ports on a given destination node by a given source node during a predefined time period. Upon detecting a port scan by one of the nodes including accesses of at least one of the communication ports in the first set and at least one of the communication ports in the second set, a preventive action is initiated.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.16/261,634, filed Jan. 30, 2019, which is incorporated herein byreference.

FIELD OF THE INVENTION

The present invention relates generally to computer security, andparticularly to detecting port scan attacks.

BACKGROUND OF THE INVENTION

In computer networking, a communication port is a logical communicationendpoint on the network that, from a software standpoint, identifies aspecific resource (e.g., a process or a type of service) executing on agiven computer in the network. Communication ports (also referred toherein simply as ports or port numbers) are typically defined by acommunications protocol. For example, ports are one of the Layer 4(i.e., the Transport Layer) protocols in the Open SystemsInterconnection (OSI) model, and are used to define network sessions inclient-server application architectures.

Ports provide a multiplexing service for multiple services or multiplecommunication sessions at one network address. In operation, ports arepart of the addressing information used to identify sources anddestinations of messages transmitted over a network. Additionally, each“open” port is typically associated with a specific service such as havea service that is connected to them such as a database service, an emailservice or a communication service.

Network port scanning is a method for determining which ports on anetwork are open. Running a port scan on a network or server revealswhich ports are open and configured to receive and/or send information.Network professionals can use port scanning tools to measure theirexposure to attackers and to monitor devices and services. Hackers, onthe other hand, scan ports to probe networks for open ports that may beexploitable and to map which services run on each device. For example, ahacker can send a message to multiple ports, and analyze the responsesfrom each given port in order to determine if the port is being used,and if so, what service is using the given port.

Documents incorporated by reference in the present patent applicationare to be considered an integral part of the application except that tothe extent any terms are defined in these incorporated documents in amanner that conflicts with the definitions made explicitly or implicitlyin the present specification, only the definitions in the presentspecification should be considered.

The description above is presented as a general overview of related artin this field and should not be construed as an admission that any ofthe information it contains constitutes prior art against the presentpatent application.

SUMMARY OF THE INVENTION

There is provided, in accordance with an embodiment of the presentinvention, a method including defining, for a given software category,respective, disjoint sets of communication ports that are used by eachof a plurality of software systems in the given software category,including at least first and second disjoint sets, identifying, in datatraffic transmitted between multiple nodes that communicate over anetwork, a set of port scans, each of the port scans including anaccess, in the data traffic, of a plurality of the communication portson a given destination node by a given source node during a predefinedtime period, and upon detecting a port scan by one of the nodesincluding accesses of at least one of the communication ports in thefirst set and at least one of the communication ports in the second set,initiating a preventive action.

In one embodiment, identifying the port scans includes identifying, inthe data traffic, a set of pairs of the source and the destinationnodes, each pair consisting of a given source node and a givendestination node, and one or more of the communication ports accessed inthe data traffic between the source and destination nodes in each pair,computing, for each pair in the set, a respective baseline level that isindicative of a first number of the communication ports that sourcenodes other than the given source node in the pair accessed on the givendestination node during a first time period, computing, for each pair inthe set, a respective test score that is indicative of a differencebetween a second number of the communication ports that the given sourcenode in the pair accessed on the given destination node during a secondtime period and the baseline level, and designating any of the pairs forwhich the test score is greater than a specified level as the portscans.

In some embodiments, detecting accesses of at least one of thecommunication ports in the first set includes detecting accesses of atleast a specified number of the communication ports in the first set,wherein the specified number is greater than one. In additionalembodiments, the at least one of the communication ports in the firstset and at least one of the communication ports in the second setinclude at least a specified number of the communication ports in eachof the first and the second sets, wherein the specified number isgreater than one.

In a first embodiment, the given software category includes operatingsystems. In a second embodiment, the given software category includesdatabase servers. In a third embodiment, the given software categoryincludes email servers. In a fourth embodiment, the given softwarecategory includes remote session applications.

In further embodiments, initiating the preventive action includegenerating an alert for the given source node in the detected port scan.In supplemental embodiments, initiating the preventive action includesrestricting access of the given source node in the detected port scan tothe network.

There is also provided, in accordance with an embodiment of the presentinvention, an apparatus including a network interface device coupled toa data network including multiple nodes that communicate via thenetwork, and at least one processor configured to define, for a givensoftware category, respective, disjoint sets of communication ports thatare used by each of a plurality of software systems in the givensoftware category, including at least first and second disjoint sets, toidentify, in data traffic transmitted between multiple nodes thatcommunicate over a network, a set of port scans, each of the port scansincluding an access, in the data traffic, of a plurality of thecommunication ports on a given destination node by a given source nodeduring a predefined time period, and upon detecting a port scan by oneof the nodes including accesses of at least one of the communicationports in the first set and at least one of the communication ports inthe second set, to initiate a preventive action.

There is additionally provided, in accordance with an embodiment of thepresent invention, a computer software product, the product including anon-transitory computer-readable medium, in which program instructionsare stored, which instructions, when read by a computer, cause thecomputer to define, for a given software category, respective, disjointsets of communication ports that are used by each of a plurality ofsoftware systems in the given software category, including at leastfirst and second disjoint sets, to identify, in data traffic transmittedbetween multiple nodes that communicate over a network, a set of portscans, each of the port scans including an access, in the data traffic,of a plurality of the communication ports on a given destination node bya given source node during a predefined time period, and upon detectinga port scan by one of the nodes including accesses of at least one ofthe communication ports in the first set and at least one of thecommunication ports in the second set, to initiate a preventive action.

BRIEF DESCRIPTION OF THE DRAWINGS

The disclosure is herein described, by way of example only, withreference to the accompanying drawings, wherein:

FIG. 1 is a block diagram that schematically shows a computing facilitycomprising a system configured to detect port scans suspected of beingmalicious, in accordance with an embodiment of the present invention;

FIG. 2 is a flow diagram that schematically illustrates a method ofidentifying, in data packets transmitted from source nodes todestination nodes over the network, suspicious port scans, in accordancewith an embodiment of the present invention;

FIG. 3 is a flow diagram that schematically illustrates a method ofgenerating a destination a profile score that can be used to detect portscans, in accordance with an embodiment of the present invention;

FIG. 4 is a flow diagram that schematically illustrates a method ofgenerating a source profile that can be used to detect and whitelistaggressive and periodic scanners, in accordance with an embodiment ofthe present invention;

FIG. 5 is a flow diagram that schematically illustrates a method ofidentifying malicious port scans comprising port scans for differentsoftware systems in a single category, in accordance with an embodimentof the present invention;

FIG. 6 is a flow diagram that schematically illustrates a method ofidentifying malicious port scans comprising outlier pairs of scannedports, in accordance with an embodiment of the present invention; and

FIG. 7 is a flow diagram that schematically illustrates a method ofidentifying and whitelisting scanner probes, in accordance with anembodiment of the present invention.

DETAILED DESCRIPTION OF EMBODIMENTS Overview

Embodiments of the present invention provide methods and systems foridentifying port scans on a data network. As described hereinbelow,while monitoring data traffic transmitted between multiple nodes thatcommunicate over a network, a set of pairs of source and destinationnodes are identified, each pair consisting of a given source node and agiven destination node, and one or more communication ports accessed inthe data traffic between the source and destination nodes in each pair.For each pair in the set, a respective baseline level and a respectivetest score are computed. For each pair in the set, the respectivebaseline level is indicative of a first number of the communicationports that source nodes other than the given source node in the pairaccessed on the given destination node a first time period, and therespective test score that is indicative of a difference between asecond number of the communication ports that the given source node inthe pair accessed on the given destination node during a second timeperiod and the baseline level. A preventive action can be initiated withrespect to the given source node in any of the pairs for which the testscore is greater than a specified level.

Embodiments of the present invention also provide methods and systemsfor detecting if any of the identified port scans comprise an anomalouscombination of ports that can indicate a malicious port scan. Examplesof anomalous combination of ports include, but are not limited to, portpairs and port groups. As described hereinbelow, the analysis to detectthe suspicious port scans may be based on source profiles, portprofiles, port pair profiles and scanner probe profiles.

System Description

FIG. 1 is a block diagram that schematically shows a computing facility20 comprising a malicious port scan detection system 22 that collectsand monitors data packets 24 transmitted between multiple nodes 26coupled to a data network 28 in order to identify malicious port scans,in accordance with an embodiment of the present invention. Inembodiments described herein, each node 26 comprises any type of device(i.e., physical or virtual) that is configured to communicate over thenetwork, and has an IP address assigned for this purpose. In the exampleshown in FIG. 1, the nodes comprise workstations 26 and a public network30 such as the Internet. As described hereinbelow, embodiments of thepresent invention aggregate the data packets into communicationsessions, identify any of the communication sessions that comprise portscans 32, and generate an alert for any of the port scans that aresuspected of being malicious.

While the example shown in FIG. 1 shows the nodes comprisingworkstations 26, nodes 26 comprising other types of devices thatcommunicate over network 28 and Internet 30 are considered to be withinthe spirit and scope of the present invention. For example, the nodesmay comprise devices such as servers, wireless devices such assmartphones, routers and network switches.

Each workstation 26 may comprise, for example, a workstation identifier(ID) 34, a workstation processor 36, a workstation memory 38 that storesa plurality of communication ports 40 (also referred to herein simply asports). Unlike physical ports, ports 40 are logical entities that aredefined by a communications protocol such as TCP/IP.

Examples of workstation IDs 34 include, but are not limited to, a mediaaccess control (MAC) addresses and Internet Protocol (IP) addresses thatcan be used to uniquely identify each of the workstations. While anygiven time, each given workstation 26 is assigned a unique IP address,the given workstation may be associated with multiple IP addresses overan extended time period. For example, the IP address for a givenworkstation 26 may change after a reboot of the given workstation.Generally, in operation, processor 36 executes, from memory 38, anoperating system 42 (e.g., Linux) and one or more software applications44 (e.g., a database server).

In the configuration shown in FIG. 1, memory 38 also stores a whitelist80 that stores the identifiers for one or more workstations 26. Asdescribed in the description referencing FIGS. 4 and 7 hereinbelow,embodiments of the present invention can ignore any suspicious port scan32 that is initiated by any workstation 26 in the whitelist.

Workstations 26 communicate over data network 28 (e.g., a local areanetwork) that is also coupled to an Internet gateway 46. Gateway 46couples computing facility 20 to public networks 30 such as theInternet, and comprises communications circuitry (not shown) thatenables communication between workstations 26 and sites/computers (notshown) on the Internet.

In some embodiments, malicious port scan detection system 22 comprises asystem processor 48 and a system memory 50, which are coupled by asystem bus (not shown) to a network interface controller (NIC) 52 thatcouples the computer system to network 28. In some embodiments,malicious port scan detection system 22 may comprise a user interface(UI) device 54 (e.g., an LED display) or another type of outputinterface.

In the configuration shown in FIG. 1, malicious port scan detectionsystem 22 comprises a probe 56 that collects information on data packets24 transmitted over network 28. While the example in FIG. 1 shows probe56 as a module of malicious port scan detection system 22, the probe canbe implemented either as a standalone device coupled to network 28, oras a module in another device coupled to the network. Probe optionallycollects data packets 24 from network 28 and processes the collecteddata packets to extract information, using any of the methods described,in U.S. Patent Application 2014/0165207 to Engel et al. and U.S. PatentApplication 2015/0358344 to Mumcuoglu et al., whose disclosures areincorporated herein by reference.

Memory 50 stores respective pluralities of communication sessions 68,aggregated communication sessions 58 and port lists 60. In embodimentsdescribed herein, processor 48 is configured to collect the data packetsfrom probe 56, to group the data packets into communication sessions 68,to aggregate the communication sessions into aggregated communicationsessions 58, and to identify any of the aggregated communicationsessions that indicate a given port scan 32. The use of port lists 60,which store respective pluralities of ports 40 (i.e., port numbers), isdescribed in the description referencing FIG. 5, hereinbelow.

In the configuration shown in FIG. 1, memory 50 also stores a whitelist80 that stores the identifiers for one or more workstations 26. Asdescribed in the description referencing FIGS. 4 and 7 hereinbelow,embodiments of the present invention can ignore any suspicious port scan32 that is initiated by any workstation 26 in the whitelist.

Each communication session 68 optionally comprises a source nodeidentifier 64, a destination port identifier 66, a time 84, a sourceport identifier 70, a destination port identifier 72, a protocol 74, astatus 76, a volume 88 (source to destination), a reverse-volume 78(also referred to as rvolume, destination to source), and a time 84.Each aggregated communication session 58 optionally comprises a portscan time period 62, a subset 86 of the communication sessions, and asignature 82.

In each given communication session 68, source node 64 stores theidentifier of a first given workstation 26, destination node 66 storesthe identifier of a second given workstation 26, source port 70 refersto a given port 40 on the first given workstation that is being used tocommunicate with the second given workstation during the givencommunication session, the destination port 72 refers to a given port 40on the second given workstation that is being accessed during the givencommunication session, the protocol 74 refers to a given communicationsprotocol (e.g., NFS, SSH, KERBEROS, LDAP) that is used by the givencommunication session, the status 76 indicates whether the givencommunication session completed successfully, volume 88 indicates anamount of data transmitted from the first given workstation to thesecond given workstation during the given communication session, andreverse volume 78 indicates an amount of data transmitted from thesecond given workstation to the first given workstation during the givencommunication session.

In embodiments described herein, source node 64 may be used to refer tothe first given workstation, and destination node 66 may be used torefer to the second given workstation. In embodiments where workstationscommunicate using TCP/IP, processor can identify the source and thedestination ports for a given communication session 68 based oninformation stored in a given data packet 24 storing the TCP header.

For each aggregated communication session 58, the port scan time period62 comprise specified time period (e.g., a specific number of hours ordays), and subset 86 refers to a plurality of communication sessions 68.Signatures 82 are described in the description referencing FIG. 7,hereinbelow.

In some embodiments, the tasks of collecting the data packets, groupingthe data packets into the communication sessions, aggregating thecommunication sessions and identifying the aggregated communicationsessions that comprise port scans 32 may be split among multiple deviceswithin computing facility 20 (e.g., workstations 26) or external to thecomputing facility (e.g., a data cloud based application). In someembodiments, the functionality of some or all of workstations 26 and/ormalicious port scan detection system 22 may be deployed in computingfacility 20 as virtual machines.

Examples of memories 38 and 50 include dynamic random-access memoriesand non-volatile random-access memories. In some embodiments, thememories may comprise non-volatile storage devices such as hard diskdrives and solid-state disk drives.

Processors 36 and 48 comprise general-purpose central processing units(CPU) or special-purpose embedded processors, which are programmed insoftware or firmware to carry out the functions described herein. Thissoftware may be downloaded to computers 22 and 26 in electronic form,over a network, for example. Additionally or alternatively, the softwaremay be stored on tangible, non-transitory computer-readable media, suchas optical, magnetic, or electronic memory media. Further additionallyor alternatively, at least some of the functions of processors 36 and 48may be carried out by hard-wired or programmable digital logic circuits.

Port Scan Collection

FIG. 2 is a flow diagram that schematically illustrates a method foridentifying suspicious port scans 32 on network 28, in accordance withan embodiment of the present invention. In embodiments described herein,a suspicious port scan comprises a source workstation 26 that accessesan anomalous combination of communication ports 40 on a destinationworkstation 26 within a predetermined time period.

In step 90, processor 48 uses probe 56 to collect data packets 24 thatare transmitted between nodes 26 on network 28 during a time period thatcomprises multiple sub-periods. For example, the time period maycomprise seven consecutive days (i.e., one week), and each sub-periodmay comprise any 24 hour period (e.g., one day) during the week.

In step 92, processor 48 groups and stores the collected data packets asindividual communication sessions 68 between respective pairs of sourceand destination nodes 26. The communication session typically comprisesa sequence of data packets 24 that a first given workstation 26transmits to a given port 40 on a second given workstation 26. Upondetecting a given sequence of data packets, processor 48 defines a newcommunication session 68, and stores, to the new communication session,the identifier for the first given workstation to source node 64, theidentifier for the second given workstation to destination node 66, thedate and time that the given sequence of data packets were collected totime 84, the port number for the first given workstation in the TCPheader to source port 70, the port for the second given workstation inthe TCP header to destination port 72, a communications protocol used bythe sequence of data packets to protocol 74, a status (e.g.,succeeded/failed) of the communication session to status 76, and a firstamount of data (e.g., 600 bytes) that the first given workstationtransmitted to the second given workstation in the sequence of datapackets to volume 88.

In some instances, the sequence of data packets may also comprise asecond volume of data (e.g., 200 bytes) that the second givenworkstation transmits to the first given workstation. Process 48 canstore the second amount of data to rvolume 78.

In some embodiments, processor 48 can group the packets according to theIP addresses (not shown) in the packets, such that the system processorcan group together packets 24 having the same source and destinationaddresses or having the same source address, source port, destinationaddress, destination port and protocol. In an alternative embodiment,processor 48 can manage a table (not shown) which correlates betweenaddresses in packets and respective IDs 34 of nodes 26, for example asdescribed in U.S. Patent Application 2016/0234167, which is incorporatedherein by reference, and groups together packets according to the IDscorresponding to the addresses in the packets. An example for groupingthe collected data packets 68 is described in U.S. patent applicationSer. No. 15/950,234, filed Apr. 11, 2018, which is incorporated hereinby reference.

In step 94, processor 48 aggregates the communication sessions into aplurality of aggregated communication sessions 58, so that each of theaggregated communication sessions comprises the data in thecommunication sessions for each unique pair of source and destinationnodes that communicated with each other during a given sub-period. Inembodiments of the present invention, each sub-period typicallycomprises a predefined time period (e.g., one hour, two hours or 24hours).

When aggregating communication sessions 68, processor 48 can identifyand flag any of the communication sessions to a given port 40 thatfailed. In embodiments herein, these flagged communication sessions maybe referred to as failed connections. A communication session to a givenport 40 can be flagged as a failed connection if no response is receivedfrom the given port, or if a response is received indicating that thegiven port is closed. A failed connection is typically a result of afaulty configuration of a given node 26, and a given port 40 can beidentified as a failed port by detecting that there are no successfulconnections to the given port on the given node. For example, if givennode 26 comprises an email server that is configured with a wrong IPaddress, other nodes 26 on the network will generate failed connectionswhen they attempt to access a wrong destination port on the emailserver.

In the TCP/IP communications model, a successful communication sessioncomprises (a) a given source node 64 transmitting a “SYN” command to agiven destination node 66, (b) the given destination node transmitting a“SYN-ACK” command to the given source node in response to receiving the“SYN” command, and (c) the given source node transmits an “ACK” commandto the given destination node in response to receiving the “SYN-ACK”command. In embodiments of the present invention, processor 48 canidentify a failed connection by detecting a given communication session68 that is missing a “SYN-ACK” command transmitted from a givendestination node 66 to a given source node 64 and/or is missing an “ACK”command transmitted from the given source node to the given destinationnode.

In embodiments of the present invention, processor 48 can use failedconnection information to determine if any of the aggregatedcommunication sessions comprise any port scans. For example, if all thecommunication sessions in a given aggregated communication session 58are successful (i.e., have successful transmissions of the “SYN”,“SYN-ACK” and “ACK” commands), them there is a low likelihood that thegiven aggregated communication session comprises a port scan. However,if all the connections in the given aggregated communication sessioncomprise failed connections on different ports 40 (as detected usingembodiments described supra), then there is a high likelihood that thegiven aggregated communication session comprises a port scan.

In step 96, processor 48 “cleans” the data in port scan records in orderto retain the data that is relevant for analysis. In one embodiment,processor 48 can clean the data by filtering out any of thecommunication sessions comprising port scans having source ports 70 andprotocols 74 that are known to have activity in numerous destinationports 72. For example, based on parameters provided by a systemsadministrator, processor 48 can filter out any of the port scans whoseprotocol is NFS and whose source port numbers are either “829”, “2049”or “20048”. In a another embodiment, a given port list 60 may comprise aset of ports 40 that are used by services available on network 28, andprocessor 48 can filter out any scans of ports 40 in the given portlist.

In step 98, processor 48 identifies one or more aggregated portcommunication sessions 58 that comprise respective port scans 32. Insome embodiments, processor 48 can use destination profiles to identifya given port scan, as described in the description referencing FIG. 3hereinbelow.

In step 100, in response to identifying the port scans in step 88,processor 48 can initiate, for the source node in each identified portscan 32, a first preventive action. In one embodiment, processor 48 caninitiate the first preventive action by presenting, on user interfacedevice 54, an alert message indicating that the identified source nodeis performing suspicious port scans. In another embodiment, processor 48can initiate the first preventive action by restricting the identifiedsource node from accessing network 28 (e.g., by conveying an instructionto a network switch or a firewall coupling the identified source node tonetwork 28).

In an additional embodiment, processor 48 can initiate the firstpreventive action by transmitting the identifier of the given sourcenode to an alert management system (not shown) such as a securityinformation and event management (SIEM) system. In a further embodiment,processor 8 can generate the alert by storing the identifier of thegiven source node to a data structure (not shown) that an alertmanagement system (e.g., a SIEM system) can extract via an API (notshown).

In one variation of the embodiments described hereinabove, processor 48can identify a user (e.g., via login credentials) of the source node inan identified port scan, and initiate the preventive action with respectto the given user. In another variation of the embodiments describedhereinabove, processor 48 can identify, on the source node in anidentified port scan, a software process that accessed the ports in theidentified port scan, and initiate the preventive action with respect tothe software process.

In step 102, processor 48 identifies a given identified port scan thatcomprises a given source node 64 that scanned an anomalous combinationof destination ports 72 on a given destination node 66 during the timeperiod (i.e., a test period). Different embodiments for detecting theanomalous combinations are described hereinbelow in the respectivedescriptions referencing FIGS. 4-7. The port scan identified in step 90may also be referred to herein as a suspicious port scan.

Finally in step 104, in response to identifying the anomalous port scansin step 102, processor 48 can initiate a second preventive action forthe source nodes in the anomalous port scans, and the method ends.Examples of preventative actions are described supra.

Destination Profiles

In embodiments of the present invention, processor 48 can usedestination profiles to detect port scans 32. As described hereinbelow,processor 48 can generate, based on data packets 24 collected during aspecified time period, destination profiles for each given destinationnode 66 that indicates a typical number of ports 40 (i.e., destinationports 72) scanned on the given destination node, and use the destinationprofiles to detect any subsequently collected port scans that areanomalous.

FIG. 3 is a flow diagram that schematically illustrates a method forcomputing destination profile scores, and using the computed scores toidentify port scans 32, in accordance with an embodiment of the presentinvention. In step 110, using embodiments described in the descriptionreferencing FIG. 2 hereinabove, processor 48 identifies a set of portscans. To identify the set of port scans, processor 48 collectscommunication sessions 68 and aggregates them into aggregatedcommunication sessions 58. Each aggregated communication session 58comprises a given port scan 32 having a first given workstation 26accessing at least one given communication port 40 on a second givendestination 26.

Processor 48 collects the communication sessions during multiple timeperiods that include a training period (also referred to herein as afirst time period) and a test period (also referred to herein as asecond time period). The test and training periods may havesubstantially identical (e.g., within 10%) time durations. For example,the test and training periods may comprise 24 hour periods. In someembodiments, the test period is subsequent to the training period. Inadditional embodiments, the training and the test periods may overlappartially of completely (i.e., the same time period).

In step 112, processor 48 identifies any of the source nodes in theaggregated communication sessions that are “noisy scanners”. Inembodiments of the present invention, a given source node 64 can beclassified as a noisy scanner if the given source node accesses (i.e.,“scans”) at least a first number (e.g., at least 20, at least 25, atleast 30, at least 35, or at least 40) of destination ports 72 on atleast a second number (e.g., 80, 90, 100, or 110) of destination nodes66 during the training period. In some embodiments, the second number isgreater than the first number. As described hereinbelow, processor 48can ignore any source node 64 that the system processor classified as anoisy scanner.

In step 114, processor 48 computes, for each pair of a given source node64 and a given destination node 66 in the aggregated communicationsessions, a baseline score (also referred to herein as a baseline level)that indicates a typical number of ports 40 that remaining first sourcenodes (i.e., excluding the given source node and in some embodiments,any of the source nodes that identified as noisy scanners) accessed onthe given destination node during a given sub-period (e.g., one day) inthe training period. In some embodiments, processor 48 can use thefollowing formula for each of the source node 66 and destination node 66pairs (i,j) to compute baseline scores:

$\begin{matrix}{{Baseline}_{i,j} = {\frac{1}{D}*{\sum_{d \in {baseline\_ days}}{\frac{1}{{L_{j}^{d}(i)}}{\sum_{k \in {L_{j}^{d}{(i)}}}\left( P_{k,j}^{d} \right)}}}}} & (1)\end{matrix}$

where

-   -   L_(j) ^(d)(i)—set of the source nodes of the destination node j        in day d (i.e., a given sub-period) excluding        {i,noisy_scanners}.    -   P_(k,j) ^(d)—a number of distinct destination ports 72 between        the source node k and the destination node j on day d.    -   D—a number of baseline days d in the training period.

In operation, processor 48 can compute Equation (1) for a singletraining period D or for a training period having multiple sub-periodsD. In embodiments with a single period D, the training and the testperiods may have substantially identical time durations, and inembodiments with multiple periods D, the sub-periods and the testperiods may have substantially identical time durations.

In step 116, processor 48 computes, for each pair of a given source node64 and a given destination node 66 in the second aggregatedcommunication sessions, a destination profile score that can be used toidentify, based on the destination ports on the destination nodesaccessed by the source nodes during the training and the test periods,any of the source nodes that are suspected of performing port scans 32.For example, processor 48 can compute, for each pair (i,j) identifiedduring the test period, the following destination profile score:

$\begin{matrix}{{Score}_{i,j} = {P_{i,j}^{*} - {Baseline}_{i,j}}} & (2)\end{matrix}$

where P_(i,j)* comprises a number of destination ports 72 that thesource node i accessed on the destination node j during the test period.In embodiments of the present invention, a higher destination profilescore for a given pair (i,j) indicates that number of ports 40 that agiven source node i scanned on a given destination node j during thetest period was greater than the ports on the given destination nodethat the given source node scanned during the training period. A higherScore_(i,j) indicates a higher probability that the source node i isperforming a port scan on the destination node j.

Finally, in step 118, processor 48 can identify a given pair of sourceand destination nodes whose destination profile score exceeds aspecified threshold (i.e., a level), thereby indicating suspicious portscans, and the method ends. In one embodiment the threshold may comprisea large score value (e.g., 7, 8, 9 or 10) for the score. In anotherembodiment the threshold may comprise a low score value (e.g., 4, 5 or6) and the number of failed connections between the source anddestination nodes during the test period is greater than a low failedconnection value (e.g., 0, 1 or 2).

Source Profile Generation

In a second anomalous port scan detection embodiment, processor 48 canuse source profiles to detect potentially malicious port scans. Asdescribed hereinbelow, processor 48 can generate, based on ports scans24 collected during a specified time period, a source profile for eachgiven source node 64 that indicates nodes whether or not a given sourcenode is either an aggressive scanner or a periodic scanner. Inembodiments of the present invention, scans from aggressive and periodicscanners are not considered to be suspicious, and the aggressive andperiodic scanners can be whitelisted.

Computer networks such as network 28 typically comprise workstations 28that can execute processes that perform legitimate port scans or performlegitimate activities that resemble ports scans (i.e. with a differentintention). Since these services or activities sometimes originate fromthe same source node 64, embodiments of the present invention cangenerate and use source profiles to detect these source nodes in orderto whitelist their legitimate port scanning activity.

FIG. 4 is a flow diagram that schematically illustrates a method forcomputing source profiles, and using the computed source profiles todetect and whitelist any source nodes 64 that are aggressive or periodicscanners, in accordance with an embodiment of the present invention. Instep 120, using embodiments described in the description referencingFIG. 2 hereinabove, processor 48 identifies a set of port scans. Toidentify the set of port scans, processor 48 collects, during a timespancomprising multiple predefined time periods, communication sessions 68and aggregates them into aggregated communication sessions 58. Eachaggregated communication session 58 comprises a given port scan 32having a first given workstation 26 accessing at least one givencommunication port 40 on a second given destination 26 during a giventime period. The predefined time periods may have substantiallyidentical time durations (e.g., one day).

In step 122, processor 48 computes, for each given source node “i” inthe port scans, scanned_dests_average_(i) that indicates an averagenumber of destination nodes 66 whose respective communication ports 40were accessed by the given source node during any given scan by thegiven source node. In some embodiments, scanned_dests_average_(i)comprises an average number of the destination nodes that the givensource node scanned per time period, omitting time periods where noscans were performed by the given source node.

In step 124, processor 48 computes for each given source node “i” in theport scans, for the given source node i,

${{scan\_ ratio}_{i} = \frac{scan\_ days}{D}},$

which indicates a fraction of the time periods D during which the givensource node accessed at least one of the destination nodes in at leastone of the port scans carried out by the given source node.

In step 126, processor 48 whitelists, based on the computedscanned_dests_average_(i) averages and scan_ratio_(i) fractions, any ofthe source nodes that are classified either as aggressive or periodicscanners, as described in the criteria hereinbelow, To whitelist a givensource node 64, processor 48 adds the given source node (i.e., thecorresponding port number) to whitelist 80.

In embodiments of the present invention, an aggressive scanner can bedefined as a given source node 64 that scans a few destination nodes 66during every time period (e.g., every day). For example, an aggressivescanner might scan a database server and a web server (i.e., twodifferent destination nodes) every hour to check on their respectivestatuses. In some embodiments, for each given source node 64, processor48 can first identify scan_days_(i) as a number of days the given sourcenode performed at least one scan, and can classify the given source nodeas an aggressive scanner if ∀i:scanned_dests_average_(i) exceeds a firstlow threshold (e.g., 2, 3, 4, 5, 6, 7) and/or scan_ratio_(i) exceeds afirst high threshold (e.g., 0.5, 0.6, 0.7, 0.8).

For example, if the first low threshold is 3, the first high thresholdis 0.5, and the daily number of destination nodes 66 scanned by a givensource node 64 is [3,0,4,4,6,3], then the given source node is anaggressive scanner since scan_days_(i)=5, scanned_dests_average_(i)=4,and scan_ratio_(i)=0.833.

In embodiments of the present invention, a periodic scanner can bedefined as a given source node 64 that scans many destinations with lessfrequency (e.g., once a week). For example, a periodic scanner may scanports 40 on all the nodes (e.g., workstations 26) on network 28 on aweekly basis to see if there are any changes such as if any new ports 40are open or if there are any respective vulnerabilities in the nodes. Ina manner similar to detecting aggressive scanners, for each given sourcenode 64, processor 48 can first identify scan_days_(i), and can classifythe given source node as a periodic scanner if∀i:scanned_dests_average_(i) exceeds a second high threshold (e.g., 10,15, 20, 25, 30, 35) and/or scan_ratio_(i) exceeds a second low threshold(e.g., 0.10, 0.15, 0.2, 0.25).

For example, if the second high threshold is 30, the first second lowthreshold is 0.1, and the daily number of destination nodes 66 scannedby a given source node 64 is [0,0,1314,0,0,0], then the given sourcenode is a periodic scanner since scan_days_(i)=1,scanned_dests_average_(i)=1314, and scan_ratio_(i)=0.14.

In one embodiment, processor 48 can receive an input (e.g., from asystem administrator) that specifies the first and second low thresholdsand the first and the second high thresholds. In another embodiment,processor 48 can dynamically set these thresholds based on therespective distributions of the computed values (i.e.,scanned_dests_average_(i) and scan_ratio_(i)). For example, processor 48can dynamically set the threshold based on (e.g., a fixed percentage) ofoutliers in the respective distributions of the computed values.

Returning to the flow diagram, in step 126, processor 48 identifies anyof the source nodes in the port scans (i.e., that were identified instep 120) that are not in whitelist 80, and the method ends.

In one embodiment, processor 48 can perform step 128 during any giventime period in order to identify a given non-whitelisted source nodethat performed a port scan during the given time period. In anotherembodiment, the time periods comprise one or more first time periodsfollowed by a second time period, and processor 48 can perform steps120-126 on the one or more first time periods, and perform step 128 onthe second time period.

Port Profiles

Embodiments described herein can use port profiles to detect potentiallymalicious port scans. Port profiles indicate which combinations of ports40 are not likely to be a part of “normal” user activity, but ratherpart of a network scan. The concept behind port profiles is that thereare combinations of ports that are suspicious if they are scanned duringa short period of time (e.g., one day). For example, if a legitimateuser wants to access a specific network service provided by a givenworkstation 26 on network 28, the user typically knows what softwareapplication is providing the service, and any port(s) 40 the softwareapplication is using.

In a first port profile embodiment, the service (also referred to hereinas a software category) comprises an operating system. For example, ifthe user wants to communicate with a given workstation running theWindows™ operating system (produced by Microsoft Corporation, Redmond,Wash.), the user can use port number “3389” which is for the remotedesktop protocol (RDP) service. However, if the user tries tocommunicate with the given workstation via port number “22”, then thatmay be suspicious since port number “22” is typically used by secureshell (SSH) service, which is a service in the Linux™ operating systemand rarely exists in Windows™ operating systems.

In a second port profile embodiment, the service comprises databasemanagement systems (DBMS). In operation, a first given workstation 26communicates with a DBMS application executing on a second givenworkstation 26 via a given port 40 on the second given workstation thatis associated with the DBMS application. In this embodiment, asuspicious port scan may comprise the first given workstationcommunicating with a large number of ports 40 (i.e., on the second givenworkstation) that are associated with a corresponding large number ofdifferent DBMS applications. This type of activity may be caused by anattacker conducting a service enumeration, which, for example, tries toidentify all the available DBMS applications on a specific server.

It is important to note that suspicious port scan activity is differentin the two embodiments described supra. In the operating systemembodiment, a small number of port scans that cross different operatingsystem port groups may be suspicious. This is because a givenworkstation 26 typically executes a single operating system. However, inthe DBMS embodiment, a suspicious port scan may require a large numberof port scans that cross different DBMS port scan groups in order to belabeled as suspicious. This is because a given workstation 26 mayexecute more than one DBMS application.

In the first port profile embodiment, processor 48 can define aplurality of port lists 60 for a corresponding plurality of operatingsystem 42. Each port list 60 comprises multiple port numbers 40 that arecommonly used by a given operating system 42. Therefore, each given portlist 60 for a given operating system 42 comprises port number 40 thatare typically used by the given operating system, and are either neveror rarely used by other operating systems 42. Examples of operatingsystems 42 that can have respective port lists 60 include, but are notlimited to Windows™ (produced by Microsoft Corporation, Redmond, Wash.),Linux™, Android™ (produced by Alphabet Inc., Mountain View, Calif.),macOS™ (also known as OS-X™, produced by Apple Inc., Cupertino Calif.).

For example:

-   -   A first given port list 60 may include the port numbers “135”,        “137” and “139”. These ports 40 are typically used by Windows™        services.    -   A second given port list 60 may include the port numbers “22”,        “23” and “111”. These ports 40 are typically used by Linux™        services.

The rationale for defining the port lists in the first port profileembodiment is that an attacker typically does not know the operatingsystem executing on a given workstation 26 that they are scanning, andone goal of the attacker is to identify operating system 42. Therefore,the attacker may scan a few ports 40 from more than one port list 60 inorder to identify the operating system executing on the givenworkstation.

For example, if a first given list 60 comprises ports used by Windows™,a second given 60 comprises ports used by Linux™ and a third given list60 comprises ports used by macOS™, then for each source node 66 anddestination node 66 pair, processor 48 can compute a tuple (N_Windows,N_Linux, N_macOS) that represent respective counts of the port numbersin the port lists that, during a test period (there is no need for atraining period) were scanned on the given destination node by the givensource node. In this example:

-   -   Processor 48 would not flag a tuple like (4,0,0), since the        given destination node is probably running Windows™.    -   Processor 48 would flag a tuple like (4,2,3), since the given        source node is trying to access ports 40 that usually used by        macOS™ but are rarely used by Windows™.

In some embodiments, processor 48 can use specified thresholds for themix of counts in the tuples to identify suspicious port scans 32 that“cross” a plurality of operating systems. In a first example, processor48 can flag the port scans in a given tuple as suspicious if the giventuple indicates a threshold number (e.g., >3, >4 or >5) of scans ofports 40 that are associated with one of the operating systems, andpositive numbers of scans of any the ports associated with the remainingoperating systems. In another example, processor 48 can flag the portscans in a given tuple as suspicious if the given tuple indicatesrespective large numbers (e.g., >3, >4 or >5) of scans of ports 40 thatare associated with least 2 different operating systems. In the firstexample, processor can flag a port scan that results in the tuple(4,1,2) as suspicious, and in the second example, the processor can flagthe port scan that results in the tuple (0,4,3) as suspicious.

In additional embodiments, processor 48 can transform the tuples intoprobabilities that the processor can use to identify suspicious portscans. For example, processor 48 can compute probabilities_tuple=[p₁,p₂, . . . , p_(n)] where

$\begin{matrix}{{p_{i} = \frac{n_{i}}{\Sigma n_{j}}},{n_{i} \in {ports\_ tuple}}} & (3)\end{matrix}$

There may be instances where the port values are small and theprobabilities are suspected to be inaccurate. In other words, eventhough a given port 40 was not previously accessed, its probability ofbeing accessed in the future is not zero. In one embodiment, processor48 can use methods such as confidence interval or Laplace smoothing inorder to improve estimation. In another embodiment, processor 48 cancompute an entropy of probabilities_tuple for a given tuple, and flagthe port scans in the tuple as suspicious (i.e., in that they areaccessing a suspicious combination of the ports in more than one of thesets) if the entropy exceeds a specified threshold (e.g., 0.1, 0.2).

In the second port profile embodiment, processor 48 can define aplurality of port lists 60 for a corresponding plurality of softwareapplications 44. Each port list 60 comprises multiple port numbers 40that are commonly used by a specific family of software applications 44.Therefore, each given port list 60 for a given software application 44comprises ports that are typically used by the given softwareapplication, and are either never or rarely used by other softwareapplications 44. In the second port profile embodiment, examples offamilies (also known as categories) of software applications 44 include,but are not limited to, database services, email services and remoteaccess services (also known as remote session services).

For example, if the family of software application 44 comprises databaseservers, then the port list for the database servers may comprise:

-   -   A first given port list 60 comprises one or more port numbers 40        for MySQL™ (e.g., “3306”).    -   A second given port list 60 comprises one or more port numbers        40 for Firebird™ (e.g., “1433”).    -   A third given port list 60 comprises one or more port numbers 40        for PostgreSQL™ (e.g., “5432”).    -   A fourth given port list 60 comprises one or more port numbers        40 for MongoDB™ (e.g., “27017”).    -   A fifth given port list 60 comprises one or more port numbers 40        for Cassandra™ (e.g., “9042”).    -   A sixth given port list 60 comprises one or more port numbers 40        for MemcacheDB™ (e.g., “11211”).    -   A seventh given port list 60 comprises one or more port numbers        40 for Aerospike™ (e.g., “3100”).

Typically a given node (e.g., a given workstation 26 or a server) mightexecute a small number (e.g., 1-3) different database server engines.Therefore, if processor 48 detects that a given source node 64 isscanning, on a given destination node 66, at least a threshold number(e.g., at least 3, at least 4 or at least 5) of ports 40 from differentport lists 60 for database servers, this may indicate that given sourcenode is looking for “any” database server, and therefore does not knowwhich one is executing on the given destination profile. When detectinga large number of ports scanned from different port lists 60 for a givennetwork service, having zero or a few few (e.g., less that 2, less than3 or less than 4) successful sessions can increase suspiciousness.

In some embodiments, processor 48 can use additional criteria such as anumber of detected failed connections correlated to different ports 40.In one example, processor 48 can flag (i.e., as suspicious) a port scanthat scans a large number (e.g., at least four or at least five) ofports 40 from different port lists 60 for database servers. In anotherexample, processor 48 can flag a port scan that scans a small number(e.g., at least two or at least three) of ports 40 from different portlists 60 for database servers as suspicious wherein at least one of theport scans has a failed connection (as described supra). Note that theseexamples are typically for port scans that are performed within a shorttimeframe (e.g., less than one hour, less than two hours or less thanthree hours).

In a first embodiment, the threshold may comprise a large number such asat least 5, at least 6 or at least 7. In a second embodiment, thethreshold may comprise a small number (e.g., at least 2, at least 3 orat least 4) of ports in different port lists, and at least 1 failedconnection on any of the port numbers in any of the port lists (i.e.,for the family). The port scans in the first and second embodiments aretypically within a short time period (e.g., one, two or three hours).

FIG. 5 is a flow diagram that schematically illustrates a method ofusing port profiles to detect cross software system port scans, inaccordance with an embodiment of the present invention. In step 130,processor 48 defines a plurality of software systems in a specificsoftware category, and in step 132, the system processor defines, foreach given software system, a given port list 60 comprising a set of oneor more ports 40 that are used exclusively by the given software system.Therefore, each port lists 50 comprise at least first and seconddisjoint sets of communication ports 40 (i.e., port numbers). Thecategory may comprise operating systems or software applications thatprovide network services such as database servers or email servers. Asdescribed supra, if the family is operating systems, then each port list60 comprises one or more ports 40 used by an operating system such asWindows™, Linux™ or macOS™. Likewise if the family is DMBS applications,then each port list 60 comprises one or more ports 40 used by a DBMSapplication such as MySQL™, PostgreSQL™ or Cassandra™.

In step 134, using embodiments described in the description referencingFIG. 2 hereinabove, processor 48 identifies a set of port scans. Toidentify the set of port scans, processor 48 collects, during apredefined time period (e.g., one hour or one day), communicationsessions 68 and aggregates them into aggregated communication sessions58. Each aggregated communication session 58 comprises a given port scan32 having a first given workstation 26 accessing at least one givencommunication port 40 on a second given destination 26.

Finally, in step 136, using embodiments described hereinabove, processor48 identifies, in the identified port scans (i.e., in step 134), a givensource node 64 that accesses at least one of the communication ports ina first port list 60 and at least one of the communication ports in asecond port list 60, and the method ends.

Deviation from Independent Model

Embodiments described herein can compute a distribution of port usage innetwork 28, and use the computed distribution to identify suspiciousport scans on the network. For example, during a training period,processor 48 can detect that the port numbers “22” and “3389” are usedfrequently, but rarely together. During a subsequent test period, ifprocessor 48 detects that a given source node 64 scanned, those twoports 40 on a given destination node 66, then the system processor cangenerate an alert for the given source node.

FIG. 6 is a flow diagram that schematically illustrates a method ofdetecting port scans 32 comprising outlier pairs of ports 40, inaccordance with an embodiment of the present invention. In step 140,using embodiments described in the description referencing FIG. 2hereinabove, processor 48 identifies a set of port scans. To identifythe set of port scans, processor 48 collects, during a predefined timeperiod, communication sessions 68 and aggregates them into aggregatedcommunication sessions 58. Each aggregated communication session 58comprises a given port scan 32 having a first given workstation 26accessing at least one given communication port 40 on a second givendestination 26.

In step 142, processor 48 computes, for each given port p scanned duringthe predefined time period, a probability P_(P) that that a given sourcenode 64 accessed a given port p on a given destination node 66 in anyport scan 32 during the predefined time period.

In step 144, processor 48 computes, for each pair of ports p1 and p2, ajoint probability JP_(p1,p2) of a connection between a given source node64 and the ports p1 and p2 on a given destination node 66 in any portscan 32 during the predefined time period.

Upon computing JP_(p1,p2) for each pair of ports 40 that were scannedduring the training period, in step 146, processor 48 computes a PortPair Score (PPS) that the system processor can use to identify pairs ofports p1 and p2 that have the following characteristics:

-   -   Port p1 is scanned frequently by any given source node 64 during        the predefined time period.    -   Port p2 is scanned frequently by any given source node 64 during        the predefined time period.    -   A given source node 64 rarely scans both ports p1 and p2 on a        given destination node 66 during the predefined time period.

To compute the Port Pair Score, processor 48 can use the followingformula

$\begin{matrix}{{PPS_{{p1},{p2}}} = {\frac{{P_{p}}_{\;^{1}}*{P_{p}}_{\;^{2}}}{{JP}_{{p\; 1},{p\; 2}}}*\left( {1 - {{P_{p1} - P_{p2}}}} \right)}} & (3)\end{matrix}$

In Equation (3), higher PPS scores indicate a pair of ports 40 that are(each) frequently scanned on the network, but are rarely scannedtogether on a given destination node 66 by a given source node 64 duringthe predefined time period. In embodiments of the present invention, thethreshold for a high PPS score can be a high value. For example thethreshold can be greater than 20, greater than 30 or greater than 40.

Finally, in step 148, processor 48 identifies any of the source nodesthat, during the predefined time period, scanned a pair of ports 40having a high Port Pair Score, and the method ends. In embodiments ofthe present invention, a scanned a pair of ports 40 having a high PortPair Score indicates that respective JP_(p1,p2) for the pair of ports p1and p2 is lower than a threshold dependent upon the respectiveprobabilities P_(P) of ports p1 and p2.

In one embodiment, the predefined time period may comprise multiplesub-periods that may have substantially identical time durations. Inthis embodiment, processor 48 can perform step 150 during any givensub-period in order to identify a given source node 64 that, during thegiven sub-period, scanned a pair of ports 40 having a high Port PairScore. In another embodiment, the sub-periods comprise one or more firstsub-periods followed by a second sub-period, and processor 48 canperform steps 140-146 on the one or more first sub-periods, and performstep 148 on the second sub-period.

Scanner Probes

Some scanning tools use a port scanning probe that comprises a givensoftware application 44 loaded on one or more nodes 26 and is configuredto scan other nodes 26 on the network, and to report results of a scanto a scanning server (e.g., a given node 26). Scanning probes can bedeployed in networks having nodes 26 that the scanning server cannotaccess directly with all the ports required for the scan (e.g., due to afirewall protecting a subset of the network). In operation, probes canbe deployed on numerous network endpoints (i.e., nodes 26) to randomlyperform port scans, and then transmit results of the scans back to agiven node (i.e., a server). Since scans performed by scanner probes maygenerate alerts, embodiments of the present invention enable processor48 to whitelist scans performed by a given scanner probe.

FIG. 7 is a flow diagram that schematically illustrates a methoddetecting any deployed scanner probes, in accordance with an embodimentof the present invention. In step 150, using embodiments described inthe description referencing FIG. 2 hereinabove, processor 48 identifiesa set of port scans. To identify the set of port scans, processor 48collects, during a predefined time period, communication sessions 68 andaggregates them into aggregated communication sessions 58. Eachaggregated communication session 58 comprises a given port scan 32having a first given workstation 26 accessing at least one givencommunication port 40 on a second given destination 26.

In step 152, processor 48 identifies, in the identified port scans, agroup of high traffic ports 40. In embodiments of the present invention,processor 48 can classify a given port 40 as having high traffic if theamount data traffic passing through the given port during the predefinedtime period exceeds a predefined threshold. Examples of predeterminedthresholds include, but are not limited to 200, 400 and 600 bytes. Insome embodiments, the given port can be on a given node 26. In otherwords processor 48 can classify the combination of the given node andthe given port as having high traffic.

In operation, processor 48 can use volume 88 and/or rvolume in thecommunication sessions of the aggregated port scan (i.e., correspondingto a given port scan 32) to determine if the data traffic in a givenport scan 32 exceeds the predefined threshold. In some embodiments,processor 48 can classify a given port 40 as having high traffic if themaximum amount of data passing through the given port in any givencommunication session (i.e., during a given port scan 32) exceeds thepredefined threshold.

In step 154, processor 48 generates, for the identified port scans,respective signatures 82 indicative of the communication ports otherthan the high-traffic ports that were accessed in each of the portscans. In other words, a given signature 82 for a given port scan 32 maycomprise a set of the communication ports that were accessed during thegiven port scan and that were not classified as having high traffic.

In step 156, processor 48 computes a respective frequency of occurrenceof each of the signatures over the set of the port scans, and in step158 the processor assembles whitelist 80 by initializing the whitelistand then adding, to the whitelist, the signatures for which therespective frequency of occurrence is greater than a predefinedthreshold. In one embodiment, the frequency of occurrence for a givensignature 82 may include information such as:

-   -   A number of occurrences that the given signature appeared in all        the identified port scans.    -   A number of sources that performed port scans 32 having        identical signatures 82 (i.e. the set of non-high volume ports)        to the given signature.    -   A number of destinations having a set of ports that were scanned        identical to the set of ports in the given signature.

In this embodiment, examples of specific thresholds include, but are notlimited to:

-   -   The number of occurrences>a first threshold such as 8, 10 or 12.    -   The number of sources>a second threshold such as 0, 1 or 2.    -   The number of sources<a third threshold such as 30, 40 or 50.    -   The number of destinations>a fourth threshold such as 0, 1, 2 or        3.    -   The number of destinations<a fifth threshold such as 10, 20, 30        or 40

In some embodiments, processor 48 can use a combination of thethresholds to identify the signatures to add to the whitelist. Forexample, a given combination may be:

Number of occurrences>10 AND

Number of sources>1 AND

Number of sources<40 AND

Number of destinations>2 AND

Number of destinations<20.

Finally, in step 160, processor 48 identifies any of the source nodes inthe identified port scans having respective signatures not in thewhitelist, and the method ends.

In one embodiment, the predefined time period may comprise multiplesub-periods that may have substantially identical time durations. Inthis embodiment, processor 48 can perform step 160 during any givensub-period in order to identify, in the given sub-period, a identifiedport scan 32 having respective signatures not in the whitelist. Inanother embodiment, the sub-periods comprise one or more firstsub-periods followed by a second sub-period, and processor 48 canperform steps 150-158 on the one or more first sub-periods, and performstep 160 on the second sub-period.

It will be appreciated that the embodiments described above are cited byway of example, and that the present invention is not limited to whathas been particularly shown and described hereinabove. Rather, the scopeof the present invention includes both combinations and subcombinationsof the various features described hereinabove, as well as variations andmodifications thereof which would occur to persons skilled in the artupon reading the foregoing description and which are not disclosed inthe prior art.

1. A method, comprising: defining, for a given software category,respective, disjoint sets of logical communication port numbers that areused by each of a corresponding plurality of software systems in thegiven software category, including at least first and second disjointsets having corresponding first and second software systems, wherein thefirst set comprises one or more logical communication port numbers usedby the first software system and rarely or never used by the secondsoftware system, and wherein the second set comprises one or morelogical communication port numbers used by the second software systemand rarely or never used by the first software system; identifying, indata traffic transmitted between multiple nodes that communicate over anetwork, a set of port scans, each of the port scans comprising anaccess, in the data traffic, of a plurality of the logical communicationport numbers on a given destination node by a given source node during apredefined time period; classifying a given port scan as non-suspiciousupon detecting the given port scan comprising accesses, by one of thesource nodes on one of the destination nodes, of one or more of thelogical communication port numbers, wherein the one or more logicalcommunication port numbers are solely in the first set; classifying thegiven port scan as suspicious upon detecting the given port scancomprising accesses, by the one of the source nodes on the one of thedestination nodes, of at least one of the logical communication portnumbers in the first set and at least one of the logical communicationport numbers in the second set; and initiating a protective action uponclassifying the given port scan as suspicious.
 2. The method accordingto claim 1, wherein detecting the access of at least one of the logicalcommunication port numbers in the first set comprises detecting a failedconnection between the one of the source nodes and a given logical portnumber in the first set on the one of the destination nodes.
 3. Themethod according to claim 1, wherein detecting accesses of at least oneof the logical communication port numbers in the first set comprisesdetecting accesses of at least a specified number of the logicalcommunication port numbers in the first set, wherein the specifiednumber is greater than one.
 4. The method according to claim 1, whereinthe at least one of the logical communication port numbers in the firstset and at least one of the logical communication port numbers in thesecond set comprise at least a specified number of the logicalcommunication port numbers in each of the first and the second sets,wherein the specified number is greater than one.
 5. The methodaccording to claim 1, wherein the given software category comprisesoperating systems, and wherein the suspicious port scan comprisesaccesses of at least one logical communication port number used by afirst operating system and at least one logical communication portnumber used by a second operating system.
 6. The method according toclaim 1, wherein the given software category comprises database servers,and wherein the suspicious port scan comprises accesses of at least onelogical communication port number used by a first database server and atleast one logical communication port number used by a second databaseserver.
 7. The method according to claim 1, wherein the given softwarecategory comprises email servers, and wherein the suspicious port scancomprises accesses of at least one logical communication port numberused by a first email server and at least one logical communication portnumber used by a second email server.
 8. The method according to claim1, wherein the given software category comprises remote sessionapplications, and wherein the suspicious port scan comprises accesses ofat least one logical communication port number used by a first remotesession application and at least one logical communication port numberused by a second remote session application.
 9. The method according toclaim 1, wherein initiating the preventive action comprises generatingan alert for the one of the source nodes in the detected port scan. 10.The method according to claim 1, wherein initiating the preventiveaction comprises restricting access of the one of the source nodes inthe detected port scan to the network.
 11. An apparatus, comprising: anetwork interface device coupled to a data network comprising multiplenodes that communicate via the network; and at least one processorconfigured: to define, for a given software category, respective,disjoint sets of logical communication port numbers that are used byeach of a corresponding plurality of software systems in the givensoftware category, including at least first and second disjoint setshaving corresponding first and second software systems, wherein thefirst set comprises one or more logical communication port numbers usedby the first software system and rarely or never used by the secondsoftware system, and wherein the second set comprises one or morelogical communication port numbers used by the second software systemand rarely or never used by the first software system, to identify, indata traffic transmitted between multiple nodes that communicate over anetwork, a set of port scans, each of the port scans comprising anaccess, in the data traffic, of a plurality of the logical communicationport numbers on a given destination node by a given source node during apredefined time period, to classify a given port scan as non-suspiciousupon detecting the given port scan comprising accesses, by one of thesource nodes on one of the destination nodes, of one or more of thelogical communication port numbers, wherein the one or more logicalcommunication port numbers are solely in the first set, to classify thegiven port scan as suspicious upon detecting the given port scancomprising accesses, by the one of the source nodes on the one of thedestination nodes, of at least one of the logical communication portnumbers in the first set and at least one of the logical communicationport numbers in the second set, and to initiate a protective action uponclassifying the given port scan as suspicious.
 12. The apparatusaccording to claim 11, wherein a given processor is configured to detectthe access of at least one of the logical communication port numbers inthe first set by detecting a failed connection between the one of thesource nodes and a given logical port number in the first set on the oneof the destination nodes.
 13. The apparatus according to claim 11,wherein a given processor is configured to detect accesses of at leastone of the logical communication port numbers in the first set bydetecting accesses of at least a specified number of the logicalcommunication port numbers in the first set, wherein the specifiednumber is greater than one.
 14. The apparatus according to claim 11,wherein the at least one of the logical communication port numbers inthe first set and at least one of the logical communication port numbersin the second set comprise at least a specified number of the logicalcommunication port numbers in each of the first and the second sets,wherein the specified number is greater than one.
 15. The apparatusaccording to claim 11, wherein the given software category comprisesoperating systems, and wherein the suspicious port scan comprisesaccesses of at least one logical communication port number used by afirst operating system and at least one logical communication portnumber used by a second operating system.
 16. The apparatus according toclaim 11, wherein the given software category comprises databaseservers, and wherein the suspicious port scan comprises accesses of atleast one logical communication port number used by a first databaseserver and at least one logical communication port number used by asecond database server.
 17. The apparatus according to claim 11, whereinthe given software category comprises email servers, and wherein thesuspicious port scan comprises accesses of at least one logicalcommunication port number used by a first email server and at least onelogical communication port number used by a second email server.
 18. Theapparatus according to claim 11, wherein the given software categorycomprises remote session applications, and wherein the suspicious portscan comprises accesses of at least one logical communication portnumber used by a first remote session application and at least onelogical communication port number used by a second remote sessionapplication.
 19. The apparatus according to claim 11, wherein a givenprocessor is configured to initiate the preventive action by generatingan alert for the one of the source nodes in the detected port scan. 20.The apparatus according to claim 11, wherein a given processor isconfigured to initiate the preventive action by restricting access ofthe one of the source nodes in the detected port scan to the network.21. A computer software product, the product comprising a non-transitorycomputer-readable medium, in which program instructions are stored,which instructions, when read by a computer, cause the computer: todefine, for a given software category, respective, disjoint sets oflogical communication port] numbers that are used by each of acorresponding plurality of software systems in the given softwarecategory, including at least first and second disjoint sets havingcorresponding first and second software systems, wherein the first setcomprises one or more logical communication port numbers used by thefirst software system and rarely or never used by the second softwaresystem, and wherein the second set comprises one or more logicalcommunication port numbers used by the second software system and rarelyor never used by the first software system; to identify, in data traffictransmitted between multiple nodes that communicate over a network, aset of port scans, each of the port scans comprising an access, in thedata traffic, of a plurality of the logical communication port numberson a given destination node by a given source node during a predefinedtime period; to classify a given port scan as non-suspicious upondetecting the given port scan comprising accesses, by one of the sourcenodes on one of the destination nodes, of one or more of the logicalcommunication port numbers, wherein the one or more logicalcommunication port numbers are solely in the first set; to classify thegiven port scan as suspicious upon detecting the given port scancomprising accesses, by the one of the source nodes on the one of thedestination nodes, of at least one of the logical communication portnumbers in the first set and at least one of the logical communicationport numbers in the second set; and to initiate a protective action uponclassifying the given port scan as suspicious.